<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

		<title></title>
		<script src="../../js/mui.min.js"></script>
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<!--App自定义的css-->
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/global.css">
		<link rel="stylesheet" type="text/css" href="../../css/app.css" />
		<link rel="stylesheet" type="text/css" href="css/app.css" />
		<script src="../../js/getURLParam.js"></script>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav headerstyle" >
			<a class="mui-action-back astyle"><img src="../../images/drawable-hdpi/head_back.png"/></a>
			<span id="title">搜索</span>
		</header>
		<div class="mui-content" style="padding-top: 10px;">
		</div>
		<!--<div id="test">test</div>
		<div id="test1">test1</div>-->
		<br />
		<div style="width: 100%;text-align: center;">
			<span>搜车辆</span>
			<hr style="color: red;" />
		</div>
		<div>
			<button>车牌号</button>
			<input id="search" style="width: 75%;" type="search"  placeholder="请输入设备号">
		</div>
		<div class="mui-content" style="padding-top: 0px;">
			<ul class="mui-table-view" id="list">
				<!--<li class="mui-table-view-cell">
					<span  onclick="goadd(this)" id="123456">京AS8095</span>
				</li>
				<li class="mui-table-view-cell">
					<span>京AS8095</span>
				</li>-->
			</ul>
		</div>
		<script>
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			document.getElementById("search").addEventListener('input',function(){
				var value= document.getElementById("search").value
				if(value.length>0 && value!=null && value!=""){
					serchvcl();
				}
			});
			var sessionid=GetQueryString("sessionid");
			var accountid=GetQueryString("accountid");
	        var proversion=GetQueryString("proversion");
	        var vcllist = document.getElementById("list");
	        var con = "";
			function serchvcl(){
				var tvalue=document.getElementById("search").value;
				mui.ajax('../../../APP/searchInfo', {
				data: {
					param: '{"proVersion":"' + proversion + '","accountId":"' + accountid + '","sessionid":"' + sessionid + '","data":{"type":"1","tValue":"'+tvalue+'"}}'
				},
				dataType: 'jsonp', //服务器返回json格式数据
				type: 'post', //HTTP请求类型
				timeout: 10000, //超时时间设置为10秒；
				success: function(data) {
					var jsonObj = window.JSON.parse(data);
					if (jsonObj.resultcode == "1") {
						con="";
						//获取返回数据的data
						var resultdata = jsonObj.data;
						if (null != resultdata) {
							for(var i=0;i<resultdata.length;i++){
								con+='<li class="mui-table-view-cell">';
								con+='<span  onclick="goadd(this)" id="'+resultdata[i].vclid+'">'+resultdata[i].vclnum;
								con+='</span></li>';
							}
							vcllist.innerHTML=con;
						} else {
							vcllist.innerHTML="无对应的匹配结果，请重新输入";
						}
			
					} else {
						
					}
				},
				error: function(xhr, type, errorThrown) {
				}
			});
			}
			function goadd(obj){
				window.location.href="vcladd.html?sessionid="+sessionid+"&accountid="+accountid+"&proversion="+proversion+"&vclid="+obj.id+"&vclnum="+obj.innerHTML;
				
			}
		</script>
	</body>

</html>